<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/loginredirect.jsp"%>
<head>
    <title><fmt:message key="menu.js1"/></title>
    <meta name="heading" content="<fmt:message key='menu.forms'/>"/>
    <meta name="menu" content="FormsMenu"/>
</head>




<div class="jquery_tab_container">
    <span class="heading_tab advanced_link active tab1"><fmt:message key="menu.js1"/></span>
</div>

<div class="jquery_tab">
    <div class="content_block"></div>


   

    <form:form commandName="basicInfoForm" method="post" action="basicinfo" id="basicInfoForm" onsubmit="return validateWork(this)">
        <form:errors path="*" cssClass="error" element="div"/>
        <form:hidden path="basicInfo.id"/>

        <p class="buttonBar bottom"  style="border-bottom: 1px solid #ccc; margin-bottom: 10px;">
            <input type="button" class="button" onclick="location.href='<c:url value="/basicinfoform"/>'" value="<fmt:message key="button.add"/>"/>
            <input type="button" class="button" name="cancel" value="<fmt:message key="button.cancel"/>" onclick="location.href='<c:url value="/menuForms"/>'"/>
        </p>

        <h3><fmt:message key="search.basicinfo" /></h3>
        <div>
            <p class="left">
                <appfuse:label styleClass="width50" key="searchPerson.firstName"/>
                <form:input path="basicInfo.firstName" id="basicInfo.firstName" cssClass="input-medium toCyr" cssErrorClass="input-medium error" maxlength="50"/>
            </p>
            <p class="left">
                <appfuse:label styleClass="width50" key="searchPerson.lastName"/>
                <form:input path="basicInfo.lastName" id="basicInfo.lastName" cssClass="input-medium toCyr" cssErrorClass="input-medium error" maxlength="50"/>
            </p>
            <p class="left">
                <appfuse:label styleClass="width150" key="searchPerson.socScrNo"/>
                <form:input path="basicInfo.socScrNo" id="basicInfo.socScrNo" cssClass="input-medium toCyr" cssErrorClass="input-medium left error" maxlength="50"/>
            </p>
            <br class="clearboth" />
        </div>

        <div>
            <p class="left">
                <appfuse:label styleClass="width150" key="basicInfo.municipality"/>
                <form:select path="basicInfo.municipality.id" id="municipalitySelect">
                    <form:option id="1" value="">
                        <fmt:message key="municipalitySearch"/>
                    </form:option>
                    <c:forEach items="${basicInfoForm.municipalities}" var="municipality">

                        <c:if test="${municipality == basicInfoForm.basicInfo.municipality}">
                            <form:option value="${municipality.id}" id="${basicInfoForm.basicInfo.municipality.id}" selected="true" >
                                ${municipality.name}
                            </form:option>
                        </c:if>
                        <c:if test="${municipality != basicInfoForm.basicInfo.country}">
                            <form:option value="${municipality.id}" id="${basicInfoForm.basicInfo.municipality.id}" >
                                ${municipality.name}
                            </form:option>
                        </c:if>
                    </c:forEach>
                </form:select>
            </p>
            <p class="left">
                <appfuse:label styleClass="width350" key="basicInfo.nationality"/>
                <form:select path="basicInfo.nationality.id" id="nationalitySelect">
                    <form:option id="1" value="">
                        <fmt:message key="nationalitySearch"/>
                    </form:option>
                    <c:forEach items="${basicInfoForm.nationalities}" var="nationality">

                        <c:if test="${nationality == basicInfoForm.basicInfo.nationality}">
                            <form:option value="${nationality.id}" id="${basicInfoForm.basicInfo.nationality.id}" selected="true" >
                                ${nationality.nationalityName}
                            </form:option>
                        </c:if>
                        <c:if test="${nationality != basicInfoForm.basicInfo.nationality}">
                            <form:option value="${nationality.id}" id="${basicInfoForm.basicInfo.nationality.id}" >
                                ${nationality.nationalityName}
                            </form:option>
                        </c:if>
                    </c:forEach>
                </form:select>
            </p>
            <p class="left">
                <appfuse:label styleClass="width150" key="basicInfo.eduLvl"/>
                <form:select path="basicInfo.eduLvl.id" id="eduLvlSelect">
                    <form:option id="1" value="">
                        <fmt:message key="eduLvlSearch"/>
                    </form:option>
                    <c:forEach items="${basicInfoForm.educationLevels}" var="eduLvl">

                        <c:if test="${eduLvl == basicInfoForm.basicInfo.eduLvl}">
                            <form:option value="${eduLvl.id}" id="${basicInfoForm.basicInfo.eduLvl.id}" selected="true" >
                                ${eduLvl.eduLvlName}
                            </form:option>
                        </c:if>
                        <c:if test="${eduLvl != basicInfoForm.basicInfo.eduLvl}">
                            <form:option value="${eduLvl.id}" id="${basicInfoForm.basicInfo.eduLvl.id}" >
                                ${eduLvl.eduLvlName}
                            </form:option>
                        </c:if>
                    </c:forEach>
                </form:select>
            </p>
            <p class="left">
                <appfuse:label styleClass="width50" key="basicInfo.gender"/>
                <form:select path="basicInfo.gender" id="genderSelect">
                    <form:option id="1" value="">
                        <fmt:message key="genderSearch"/>
                    </form:option>
                    <c:if test="${'Male' == basicInfoForm.basicInfo.gender}"> 
                        <form:option id="2" value="Male" selected="true" >
                            <fmt:message key="male"/>
                        </form:option> 
                    </c:if>  
                    <c:if test="${'Male' != basicInfoForm.basicInfo.gender}"> 
                        <form:option id="2" value="Male" >
                            <fmt:message key="male"/>
                        </form:option> 
                    </c:if>
                    <c:if test="${'Female' == basicInfoForm.basicInfo.gender}"> 
                        <form:option id="3" value="Female" selected="true" >
                            <fmt:message key="female"/>
                        </form:option> 
                    </c:if>  
                    <c:if test="${'Female' != basicInfoForm.basicInfo.gender}"> 
                        <form:option id="3" value="Female" >
                            <fmt:message key="female"/>
                        </form:option> 
                    </c:if>
                </form:select>
            </p>
            <br class="clearboth" />
        </div>



        <p class="buttonBar bottom">

            <input type="submit" class="button" name="search" value="<fmt:message key="button.search"/>"/>

        </p>

    </form:form>

    <display:table name="searchList" class="table" requestURI="" id="searchList" export="false" pagesize="25">
        <display:column property="firstName" titleKey="employment.firstName" sortable="true" href="basicinfoform?" media="html"
                        paramId="id" paramProperty="id" />
        <display:column property="lastName" sortable="true" titleKey="basicInfo.lastName"/>
        <display:column property="fathersName" sortable="true" titleKey="basicInfo.fathersName"/>
        <display:column property="socScrNo" sortable="true" titleKey="basicInfo.socScrNo"/>
        <display:column property="gender"  sortable="true" titleKey="basicInfo.gender"/>         
        <display:column property="nationality.nationalityName" sortable="true" titleKey="basicInfo.nationality"/>
        <display:column property="municipality.name" sortable="true" titleKey="basicInfo.municipality"/>
        <display:column property="eduLvl.eduLvlName" sortable="true" titleKey="basicInfo.eduLvlName"/>

    </display:table>

</div>




<v:javascript formName="basicInfoForm" cdata="false" dynamicJavascript="true" staticJavascript="false"/>
<script type="text/javascript" src="<c:url value='/scripts/validator.jsp'/>"></script>

<script type="text/javascript">
    Form.focusFirstElement($('basicInfoForm'));
</script>

<script type="text/javascript">
    highlightTableRows("searchList");
</script>


